package com.qf.leadnewsschedule.controller.v1;

import com.qf.leadnewsfeignapi.schedule.ScheduleApi;
import com.qf.leadnewsmodel.dtos.ResponseResult;
import com.qf.leadnewsmodel.pojos.schedule.Task;
import com.qf.leadnewsschedule.service.TaskinfoService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

@RestController
@RequestMapping("/api/feign/schedule")
public class TaskController implements ScheduleApi {

    @Autowired
    private TaskinfoService taskinfoService;

    @PostMapping("/add")
    public ResponseResult addTask(@RequestBody Task task){
        return taskinfoService.add(task);
    }

    @GetMapping("/consumeTask/{taskType}/{priority}")
    public ResponseResult consumeTask(@PathVariable("taskType") int taskType,@PathVariable("priority") int priority){
        return taskinfoService.consumeTask(taskType,priority);
    }
}
